﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ZWZ.Web.WebAdmin.UCtrs
{
    public partial class SelUsers : System.Web.UI.UserControl
    {
        public string SelectedUserID
        {
            get
            {
                return DropDownList1.SelectedValue;
            }
            set
            {
                DropDownList1.SelectedValue = value;
            }
        }
        public string SelectedUserName
        {
            get { return DropDownList1.SelectedItem.Text; }
        }
        public Unit Width
        {
            get { return DropDownList1.Width; }
            set { DropDownList1.Width = value; }
        }
        public Unit Height
        {
            get { return DropDownList1.Height; }
            set { DropDownList1.Height = value; }
        }
        public string CssClass
        {
            get
            {
                return DropDownList1.CssClass;
            }
            set
            {
                DropDownList1.CssClass = value;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownList1.DataSource = DBProvider.DB.Ctx.User_Info.Select(user =>
                    new
                    {
                        user.ID,
                        user.NickName
                    });
                DropDownList1.DataTextField = "NickName";
                DropDownList1.DataValueField = "ID";
                DropDownList1.DataBind();
            }
        }
    }
}